{extend name="template/base" /}
{block name="content"}
<style>

    .ID_img{
        width: 120px;
        height:120px;
        text-align: center;
        margin-left: 15px;
        border: 1px solid #E2E2E2;
        float: left;
        position: relative;
    }
    .ID_img>input{
        display: inline-block;
        width: 80%;;
        height: 80%;
        opacity: 0;
        z-index: 800;
        position: absolute;
        left:10%;
        top:0;
    }
    .ID_img .img_{
        width: 80%;
        height: 80%;
        margin-top: 10%;
        position: absolute;
        top: 0;
        left: 10%;
    }

</style>
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$info.id ?? ''}">
        <div class="row cl" style="margin-top: 30px">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>类型：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select class="select" name="type">
                    <option value="1" {if condition="$info.type eq 1"}APP{/if}>APP</option>
                    <option value="2" {if condition="$info.type eq 2"}APP{/if}>浏览器</option>
                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl" style="margin-top: 30px">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>标题：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text"  name="title" datatype="*" value="{$info.title}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>图标：</label>
            <div class="formControls col-xs-3 col-sm-3 ID_img">
                <input type="file"  accept="image/*" class="preview level_img" value=""  onchange="imgChange(this)" />
                <img  class="img_"   src="{if condition="$info.img"}{$info.img}{else/}__STATIC__/images/icon_add.png{/if}">
                <input type="hidden"  name="img" class="base64_val" id="code_logo" datatype="*"  value="{$info.img}"/>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script src="__STATIC__/js/mobileFix.mini.js?v=ad62f13"></script>
<script src="__STATIC__/js/exif.js?v=dd609b9"></script>
<script src="__STATIC__/js/lrz.js?v=3d33fcf"></script>

<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script>
    function imgChange(el){
        var $this = $(el);
        var sizes = $this[0].files[0].size;
        if(sizes > 1024*1024*2){
            alert('图片大小不能超过2M');
            return false;
        }
        lrz($this[0].files[0], {width: 0}, function (results) {
            $this.siblings('.img_').attr('src', results.base64).siblings('.base64_val').val(results.base64);
        });
    }
    $(function () {
        $('.cjxh').show()
        $('.cjxhs').hide()
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret) {
                ajax_progress(ret);
            }
        });
    });

</script>
{/block}